package com.example.validdemo.log;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * @author shenhan
 * @create 2020/1/19 16:03
 * @description
 */
@Component
@Aspect
public class ApiLogAspect {
    @Pointcut("@annotation(com.example.validdemo.log.ApiLog)")
    public void apiLogLoger() {
    }

    @AfterReturning(value = "apiLogLoger()", returning = "result")
    public void afterReturning(JoinPoint joinPoint, Object result) {
        System.out.println(result.toString());
        System.out.println(joinPoint.getSignature().toString());
        System.out.println("切面来了");
    }
}
